package common.database.implementations;

import java.sql.SQLException;

import org.springframework.beans.factory.annotation.Autowired;

import com.mchange.v2.c3p0.ComboPooledDataSource;

public class C3poConnectMonitor {
	@Autowired
	private ComboPooledDataSource mySqlDataSource;
	
	@Autowired
	private ComboPooledDataSource orcaleDataSource;

	public String monitor() throws SQLException {
		StringBuffer sb = new StringBuffer();
		sb.append("num_connections: "+ mySqlDataSource.getNumConnectionsDefaultUser()+",");
		sb.append("num_busy_connections: "+ mySqlDataSource.getNumBusyConnectionsDefaultUser());
		sb.append("num_idle_connections: "+ mySqlDataSource.getNumIdleConnectionsDefaultUser());
		return sb.toString();
	}
	
}
